/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gitee.wsl.db.dsl.query

/**
 * @author Administrator
 */
class QBFParameter {
    var fieldName: String? = null
    var qbf: QBFCompareEnum? = null
    var value: Any? = null

    //boolean notFlag;//not 标志位
    constructor()

    constructor(fieldName: String?) {
        this.fieldName = fieldName
        qbf = QBFCompareEnum.COMP_NONE
    }


    constructor(fieldName: String?, qbf: QBFCompareEnum?, value: Any?) {
        this.fieldName = fieldName
        this.qbf = qbf
        this.value = value
    }

    val isNull: QBFParameter
        get() {
            qbf = QBFCompareEnum.COMP_ISNULL
            return this
        }

    val isNotNull: QBFParameter
        get() {
            qbf = QBFCompareEnum.COMP_ISNOTNULL
            return this
        }

    fun like(value: Any?): QBFParameter {
        qbf = QBFCompareEnum.COMP_RE
        this.value = value
        return this
    }

    fun equal(value: Any?): QBFParameter {
        qbf = QBFCompareEnum.COMP_EQUALS
        this.value = value
        return this
    }

    fun distanct(value: Any?): QBFParameter {
        qbf = QBFCompareEnum.COMP_DISTINCT
        this.value = value
        return this
    }

    fun greater(value: Any?): QBFParameter {
        qbf = QBFCompareEnum.COMP_GREATER
        this.value = value
        return this
    }

    fun less(value: Any?): QBFParameter {
        qbf = QBFCompareEnum.COMP_LESS
        this.value = value
        return this
    }

    fun greaterOrEqual(value: Any?): QBFParameter {
        qbf = QBFCompareEnum.COMP_GREATEROREQUALS
        this.value = value
        return this
    }

    fun lessOrEqual(value: Any?): QBFParameter {
        qbf = QBFCompareEnum.COMP_LESSOREQUALS
        this.value = value
        return this
    }

    fun `in`(value: Any?): QBFParameter {
        qbf = QBFCompareEnum.COMP_IN
        this.value = value
        return this
    }

    fun clear(): QBFParameter {
        qbf = QBFCompareEnum.COMP_NONE
        this.value = null
        return this
    }
    /*
    public QBFParameter not(){
    	this.notFlag=true;
    	return this;
    }*/

    companion object {
        var ALL: QBFParameter = QBFParameter("", QBFCompareEnum.COMP_ALL, null)
    }
}
